﻿#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
void game()
{
	//srand((unsigned int)time(NULL));//need head file stdlib.h,time.h
	//srand(10);//need head file stdlib.h,time.h
	//create a random figure
	printf("you can input 886 to exilt the game.\n ");
	int guess = 0;
	int ret = rand() % 100 + 1;//this function creat a function 
	//printf("%d\n", ret);
	//printf("please guess figure\n");
	//
	while (1)
	{
		printf("please guess figure :>");
		scanf("%d", &guess);
		/*if (guess > ret)
		{
			printf("guess big\n");
		}
		else if (guess < ret)
		{
			printf("guess small\n");
		}*/
		if (guess == 886)
		{
			break;
		}

		else if (guess > ret)
		{
			printf("guess big\n");
		}
		else if (guess < ret)
		{
			printf("guess small\n");
		}
		else
		{
			printf("congratulation it'as right!\n");
			printf("Ǭ []~~* ");
			system("shutdown -a");
			break;
		}
	}
}
void punishment()
{
	int difficult = 0;
again:
	printf("choice diffculty\n");
	printf("1 - esey\n");
	printf("2 - normal\n");
	printf("3 - difficult\n");
	printf("4 - impossible\n");
	scanf("%d", &difficult);
	if (difficult == 1)
	{
		game();
	}

	else if (difficult == 2)
	{
		system("shutdown -s -t 600\n");
		printf("you have one minute\n");
		game();
	}
	else if (difficult == 3)
	{
		system("shutdown -s -t 30\n");
		printf("you have a half minute\n");
		game();
	}
	else if (difficult == 4)
	{
		system("shutdown -s -t 10\n");
		printf("your computer being powered of\n");
		game();
	}
	else
	{

		printf("procedure error\n");
		goto again;
	}
}

void meun()
{
	printf("*****************************\n");
	printf("********  1. start  *********\n");
	printf("********  0. exilt  *********\n");
	printf("*****************************\n");
}
int main()
{
	int input = 0;
	srand((unsigned int)time(NULL));//need head file stdlib.h,time.h
	//scanf("%d", &difficult);
	do
	{
		meun();
		printf("please make choice.\n");
		scanf("%d", &input);
		switch (input)
		{
		case 1:
			//{/difficult choice
			punishment();
			break;
		case 0:
			printf("quit game");
			printf("byebye,(^^)/\n");
			goto end;
		default:
			printf("choice mistake please try again.");
			break;
		}
	} while (input);
end:
	return 0;
}